<template>
  <div class="credit">
     <Form   :model="product" :rules="ruleValidate" ref="product" :label-width="80" style="width:900px">
        <h3 class="title">编辑产品</h3>
        <FormItem label="产品名称" prop="name" class="width50">
          <Input v-model="product.name"></Input>
        </FormItem>
        <FormItem label="	金额" prop="money" class="width50">
          <Input v-model="product.money"></Input>
        </FormItem>
         <FormItem label="实放款金额" prop="money" class="width50">
          <Input v-model="product.realMoney"></Input>
        </FormItem>
        <FormItem label="产品天数" prop="day" class="width50">
          <Input v-model="product.day" disabled></Input>
        </FormItem>
        <FormItem label="基准日利率" prop="dayRate" class="width50">
          <Input v-model="product.dayRate" disabled></Input>
        </FormItem>
        <FormItem label="基准手续费" prop="poundageRate" class="width50">
          <Input v-model="product.poundageRate" disabled></Input>
        </FormItem>
        <FormItem label="	逾期日利率" prop="overdueDayRate" class="width50">
          <Input v-model="product.overdueDayRate" disabled></Input>
        </FormItem>
        <FormItem label="	违约日利率" prop="penaltyDayRate" class="width50">
          <Input v-model="product.penaltyDayRate" disabled></Input>
        </FormItem>
        <FormItem label="商户Id" prop="merchantId" class="width50">
          <Input v-model="product.merchantId" disabled></Input>
        </FormItem>
      </Form>
      <div style="margin-left: 50px;margin-top:20px;">
        <Button @click="cancel" style="margin-right:5px">取消</Button>
        <Button type="primary" @click="ok">确定</Button>
      </div>
  </div>
</template>

<script>
// import listMixin from "../../mixin/list";
export default {
  // mixins: [listMixin],
  // props:['title'],
  data() {
    return {
      tag: {
        title: "产品编辑",
        path: "/work/credit/edit"
      },
      basicInfo:{},
      title:'',
      product: {},
      ruleValidate: {
        title: [
          { required: true, message: '请填写通知标题', trigger: 'blur' }
        ],
        content: [
          { required: true, message: '请填写通知内容', trigger: 'blur' }
        ],
      },
      type:'编辑',
    };
  },
  mounted() {

  },
  methods: {
     resetValidate(name) { //清空判断
        this.$refs[name].resetFields();
      },
      ok() { //确定
        let url = '';
        this.$refs['product'].validate((valid) => {
          if (valid) {
            let data = {
              title: this.product.title,
              content: this.product.content,
            };
            if(this.type == '增加'){
              this.title = '新增通知'
              url = '/bkannouncement/append';
            }else if(this.type == '编辑'){
              this.title = '新增通知'
              url = '/bkannouncement/modify';
            }
            this.$post(url, data)
              .then((res) => {
                if(res.code === 0){
                  console.log(res,'edit')
                  this.showModal = false;
                  this.$Message.success(`${this.type}成功！`);
                  this.getList(this.url);
                }
              }, (err) => {
                console.log(err);
              })
          }
        })
      },
      cancel() {
        this.showModal = false;
      },
  }
};
</script>

<style scoped lang="less">
.credit {
  .title {
    margin-bottom: 15px;
    margin-left: 10px;
    border-left: solid 3px #20a0ff;
    padding-left: 15px;
    font-weight: bolder;
    font-size: 16px;
    color: #000;
  }
  .width50 {
    width: 45%;
    display: inline-block;
  }
  .width40 {
    width: 40%;
    display: inline-block;
  }
  .width35 {
    width: 35%;
    display: inline-block;
  }
  .width30 {
    width: 30%;
    display: inline-block;
  }
  .width20 {
    width: 15%;
    display: inline-block;
  }
  .idcimg img {
    width: 100px;
    height: 100px;
    margin-right: 30px;
  }
  .imgGroup {
    div {
      display: inline-block;
      margin-right: 30px;
      img {
        width: 100px;
        height: 100px;
      }
      p {
        text-align: center;
      }
    }
  }
}
</style>
